<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Operator+可用于将变量转换为数字</title>
</head>

<body>
    <p> typeof 操作符返回变量或表达式的类型。</p>
    <button onclick="myFunction()">点我</button>
    <p id="demo"></p>
    <script>
        function myFunction() {
            var y = "5";
            var x = + y;
            document.getElementById("demo").innerHTML =
                typeof y + "<br>" + typeof x;
        }
    </script>
</body>

</html>